package com.company;


import sun.security.util.Length;

import java.util.ArrayList;
import java.util.Iterator;//是抽象类，不能被new！对象.iterator()来返回具体容器的迭代器！
import java.util.List;    //容器对象具体有返回迭代器的方法！不是构建新对象，前半截只是声明的类型！
import java.util.Scanner;

public class add {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        List<String> list = new ArrayList<>();
        System.out.println("请输入您的id:");
        String id =scanner.nextLine();
        list.add("000000000000");
    for(Iterator<String> iter=list.iterator();iter.hasNext();){  //迭代器的泛型只能是对象。字符串是对象！
        String idtrue = iter.next();
        try{Long.parseLong(id);}catch (Exception e){System.out.println("id格式非法！");break;}
        finally {
        }





        if(id.length()==12||id.length()==6){
            if(id.equals(idtrue)){System.out.println("id创建失败，数据重复");}
            else{
                list.add(id);
                System.out.println("id创建成功");}
        }else{System.out.println("id格式出错！");}

        System.out.println("请输入您的身份:");
        String str1=scanner.nextLine();
        System.out.println("输入名字:");
        String str2 =scanner.nextLine();
        System.out.println("输入性别:");
        String str3 =scanner.nextLine();
        System.out.println("输入班级:");
        String str4 =scanner.nextLine();
        System.out.println("输入用电:");
        String str5 =scanner.nextLine();
        System.out.println("输入用水:");
        String str6 =scanner.nextLine();

    }
































    }
}
